class Fraction:
    def __init__(self, top, bottom):
        self.num = top
        self.den = bottom

    def __repr__(self):
        return f'{self.num}/{self.den}'

    @staticmethod
    def gcd(m, n):
        while m % n != 0:
            old_m = m
            old_n = n

            m = old_n
            n = old_m % old_n

        return n

    def __add__(self, other):
        new_num = self.num * other.den + other.num * self.den
        new_den = self.den * other.den
        common = Fraction.gcd(new_num, new_den)
        return Fraction(new_num//common, new_den//common)

    def __sub__(self, other):
        new_num = self.num * other.den - other.num * self.den
        new_den = self.den * other.den
        common = Fraction.gcd(new_num, new_den)
        return Fraction(new_num // common, new_den // common)

    def __eq__(self, other):
        first_num = self.num * other.den
        second_num = self.den * other.num

        return first_num == second_num


if __name__ == "__main__":
    my_fraction = Fraction(3, 5)
    my_fraction1 = Fraction(1, 5)
    a = my_fraction - my_fraction1
    print(my_fraction == my_fraction1)
